
const userDao = require("../../dao/user/userDao");

module.exports={
     //登录
    async login(name,pwd){
        return  await userDao.getuserByNameAndPwd(name,pwd)
    },
     //注册
     async registerUser(name,pwd){
       let res =await userDao.getuserByName(name)
       if(res==null){
        await userDao.insertUser(name,pwd);
        return  {"code":1,"msg":"注册成功"}
       }else{
           return  {"code":0,"msg":"注册失败，用户名不能重复"}
       }
    }

}